﻿
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http;
namespace MyCode.Tools
{
    public interface ICacheHelper
    {
        /// <summary>
        ///  缓存操作对象
        /// </summary>
        IMemoryCache _memoryCache { get; set; }
        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T GetCache<T>();
        /// <summary>
        /// 设置缓存（滑动过时间）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        void SetCache<T>(T t);
        /// <summary>
        ///  设置缓存（绝对时间过期）
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        void SetCacheAbsolute<T>(T t);
        /// <summary>
        ///  删除缓存
        /// </summary>
        void Remove();
    }
}
